package 蓝桥真题;

import java.util.Arrays;

public class 算式900 {
       static int four[]=new int[10000],idx;
       public static void main(String[] args) {
              int a[]={0,3,4,5,6,7,8,9};
              for(int i=0;i<8;i++)
            	  for(int j=0;j<8;j++)
            		  for(int m=0;m<8;m++)
            			  for(int n=0;n<8;n++)
            				  if(a[i]!=0&&i!=j&&i!=m&&i!=n&&j!=m&&j!=n&&m!=n)
            				  four[idx++]=Integer.parseInt(""+a[i]+a[j]+a[m]+a[n]);
              for(int i=0;i<idx;i++)
            	  for(int j=i+1;j<idx;j++)
            		  if(Math.abs(four[i]-four[j])==75){
            			  char[] cs = (""+four[i]+four[j]+12).toCharArray();
         		          Arrays.sort(cs);
         		          if(String.valueOf(cs).equals("0123456789")){
         		        	  System.out.print(four[i]+" "+four[j]);
         		        	  return;
         		          }
            		  }
	}  
}
//{0,1,2,3,4,5,6,7,8,9}
//10 90
//12 75
//15 60
//18 50
//20 45

//30 30